home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ETO Development Tools 4
/
ETO Development Tools 4.iso
/
Tools - Objects
/
Macintosh Programmer’s Workshop
/
MPW 3.1
/
SADE 1.1
/
SADEScripts
/
FCBChecker
< prev
next >
Wrap
Text File
|
1990-12-13
|
3KB
|
77 lines
# Symbolic Application Debugging Environment 1.0 Final
#
# Copyright Apple Computer, Inc. 1987-1988
# All rights reserved.
###############################################################################
# a small set of routines to list out all of the FCBs
#-------------------------------------------------------------------------------------------
# FCBLen -- returns the length of the FCB, 20 if we are running MFS (which we won't ever be)
# or what's in $3F6 if HFS.
#-------------------------------------------------------------------------------------------
func FCBLen ()
define FSFCBLen := ^word($3F6)^ # fetch value of low-memory global
define MFSFCBLen := 20 # we know this to be true, for ever and ever
if (FSFCBLen < 0) # less than zero means MFS
return(MFSFCBLen);
else
return(FSFCBLen);
end
end # func FCBLen
#-------------------------------------------------------------------------------------------
# DisplayAnFCB -- displays the entryNumth entry in the FCB table. Does NOT check to see
# if the entry is actually in the table, that's left to the caller
#-------------------------------------------------------------------------------------------
proc DisplayAnFCB(entryNum)
define theFCBsAddr,theRefNum
# the following are offsets into the FCB
define fileNumOffset := 0;
define PEOFOffset := 12;
define fileTypeOffset := 50;
define fileNameOffset := 62;
theRefNum := (entryNum * FCBLen()) + 2; # "+2" accounts for the length word at the
# start of the FCB block
theFCBsAddr:= FCBsPtr^+ theRefNum;
printf("$%.4X",theRefNum); # print the refnum
if (theFCBsAddr+fileNumOffset)^ = 0 # the file is unused
printf(" unused\n");
else
printf(" $%.8X",(theFCBsAddr+fileNumOffset)^); # print the file number
printf(" $%.8X",(theFCBsAddr+PEOFOffset)^);
printf(" %#s",(theFCBsAddr+fileTypeOffset)^);
printf(" %P\n",^pstring(theFCBsAddr+fileNameOffset)^);
end
END; # proc DisplayAnFCB
#-------------------------------------------------------------------------------------------
# DisplayFCBs -- loops through and lists all FCBs by calling DisplayAnFCB
#-------------------------------------------------------------------------------------------
proc DisplayFCBs
# global variable
define global FCBsPtr := $34E # location of pointer to FCBs
define i,numFCBs
# print header
numFCBs:= ^Word(FCBsPtr^)^ / FCBLen(); # we don't really need this variable, but what the hey
printf("There are %t FCBs starting at $%.8X\n\n",numFCBs,FCBsPtr^);
printf("RefNum File# PEOF FType Name\n");
printf("------ ----- ---- ----- ----\n");
for i:= 0 to numFCBs-1 # FCB table is zero based
DisplayAnFCB(i) # display this FCB
end #for
undefine FCBsPtr;
end; # proc DisplayFCBs